﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TowerDefender.Model;
using System.Windows.Controls;
using TowerDefender.Graphics.Animated.Mobs;

namespace TowerDefender.Graphics
{
    public class PeonManager
    {
        public static PeonGraphics CreatePeonGraphics(Peon peon, Map m, Grid g)
        {
            PeonGraphics pg = new PeonGraphics(peon, m);
            g.Children.Add(pg);
            pg.Visibility = peon.Visible ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden;
            return pg;
        }

        public static void DrawPeon(PeonGraphics peonGraphics, Peon peon, Map m)
        {


            if (peon.Coordinates != null)
            {
                peonGraphics.Visibility = peon.Visible ? System.Windows.Visibility.Visible : System.Windows.Visibility.Hidden;
                peonGraphics.SetValue(Grid.ColumnProperty, peon.Coordinates.X - 1);
                peonGraphics.SetValue(Grid.RowProperty, peon.Coordinates.Y - 1);
            }
            else
            {
                peonGraphics.Visibility = System.Windows.Visibility.Hidden;
            }


        }
    }
}
